package com.cy3;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 2022年7月31日练习
 *
 * @author xxx
 * @date 2022/07/31 00:04
 **/
public class J731 {
    static int sum;

    public static void main(String[] args) {
        // new Dog().display();
        // func(123);
        // System.out.println(sum);
        // 汉诺塔问题
        han(10, 'A', 'B', 'C');
        int[] c = new int[] {1, 2, 3};

        List<int[]> ints = new ArrayList<int[]>(Arrays.asList(c));


    }

    private static void han(int i, char pos1, char pos2, char pos3) {
        if (i == 1) {
            move(pos1, pos2);
            return;
        }
        han(i - 1, pos1, pos3, pos2);
        move(pos1, pos3);
        han(i - 1, pos2, pos1, pos3);
    }

    private static void move(char pos1, char pos2) {
        System.out.print(pos1 + "->" + pos2 + " ");
    }

    public static int func(int n) {
        if (n <= 9) {
            return sum += n;
        } else {
            func(n / 10);
            return sum += n % 10;
        }
    }
}

class Animal {
    String name;

    Animal() {
        System.out.println("动物！");
    }
}

class Dog extends Animal {
    Dog() {
        super();
        System.out.println("我是一只哈士奇！");
    }

    void display() {
        System.out.println(name);
    }
}
